

#ifndef _SDK_LIST
#  define _SDK_LIST

#  include <stdlib.h>
#  include <sudoku.h>

typedef struct _sdk_list_elem {

  struct _sdk_list_elem *next;
  int num;

} sdk_elem;

typedef sdk_elem sdk_list;

sdk_elem *sdk_list_remove_elem(sdk_list *, sdk_elem *);
sdk_elem *sdk_list_remove_num(sdk_list *, int);
sdk_elem *sdk_list_remove_offset(sdk_list *, int);
sdk_elem *sdk_list_get_elem(sdk_list *, int);
sdk_elem *sdk_list_get(sdk_list *, int);
void      sdk_list_add(sdk_list *, sdk_elem *);
void      sdk_list_add_num(sdk_list *, int);
int       sdk_list_length(sdk_list *);
sdk_list *sdk_list_create();
sdk_list *sdk_list_copy(sdk_list *);
void      sdk_list_copy_dest(sdk_list *, sdk_list *);
void      sdk_list_destroy(sdk_list *);
int       sdk_list_destroy_elem(sdk_list *, sdk_elem *);
void      sdk_list_destroy_elems(sdk_list *);
int       sdk_list_destroy_num(sdk_list *, int);
void      sdk_list_destroy_all(sdk_list *);
void     _sdk_list_print_sum(sdk_list *);
void     _sdk_list_print_short_sum(sdk_list *);

#  define SDK_LIST_TRAV(LIST, ELEM) \
  for ( ELEM = LIST->next; ELEM != NULL; ELEM = ELEM->next)

#  define SDK_LIST_ALLOC() ((sdk_list *) malloc(sizeof(sdk_list)));\
  _sdk_memory += sizeof(sdk_list);
#  define SDK_ELEM_ALLOC() ((sdk_elem *) malloc(sizeof(sdk_elem)));\
  _sdk_memory += sizeof(sdk_elem);

#endif
